<!DOCTYPE html>
<html>
<head>
    <title><%= title %></title>
    <link rel='stylesheet' href='/stylesheets/style.css'/>
    <link rel="stylesheet" href="/lib/layui/css/layui.css">
    <script type="application/javascript" src="/lib/layui/layui.all.js"></script>
    <style>
        html, body {
            width: 100%;
            height: 100%;
            padding: 0;
            margin: 0;
        }

        .login_main {
            width: 100%;
            height: 100%;
            background: url("../images/common/bg.jpg") center center no-repeat;
            background-size: cover;
            overflow: hidden;
        }

        .login_wrapper {
            width: 380px;
            height: 260px;
            background: rgba(0, 0, 0, 0.3);
            position: relative;
            left: 50%;
            top: 50%;
            padding: 25px;
            margin-left: -190px;
            margin-top: -130px;
            border-radius: 5px;
            color: #fff;
        }
        .layui-form-item{
            position: relative;
            margin-bottom: 25px;
        }
        .layui-icon{
            position: absolute;
            left: 1px;
            top: 1px;
            width: 38px;
            line-height: 36px;
            text-align: center;
            color: #d2d2d2;
        }
        .layadmin-user-login-header{
            padding: 20px;
            text-align: center;
        }
        .layui-input{
            padding-left: 40px;
        }
        .require{
            text-align: center;
            color: red;
            font-size: 20px;
        }
    </style>
</head>
<body>
<div class="login_main">
    <form action="/api/login" method="post" class="login_wrapper layui-form">
        <div class="layadmin-user-login-box layadmin-user-login-header">
            <h2>后台管理系统</h2>
        </div>
        <div class="require"><%= msg %></div>
        <div class="layui-form-item">
            <label class="layadmin-user-login-icon layui-icon layui-icon-username"
                   for="LAY-user-login-username"></label>
            <input type="text" name="username" id="LAY-user-login-username" lay-verify="username" placeholder="用户名"
                   class="layui-input">
        </div>
        <div class="layui-form-item">
            <label class="layadmin-user-login-icon layui-icon layui-icon-password"
                   for="LAY-user-login-password"></label>
            <input type="password" name="password" lay-verify="pass" id="LAY-user-login-password"  placeholder="密码"
                   class="layui-input">
        </div>
        <div class="layui-form-item">
            <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="submit">登 入</button>
        </div>
    </form>
</div>
</body>
<script>
    //提交
    layui.use(['form'], function() {
        var form = layui.form;
        //自定义验证规则
        form.verify({
            username: function (value) {
                if (value.length < 5) {
                    return '标题至少得5个字符啊';
                }
            }
            , pass: [/(.+){5,12}$/, '密码必须6到12位']
        });
    });
</script>
</html>
